package com.ithuaxin.objectoriented;

public class GirlFriend {
    private int age;
    private String name;
    public void setAge(int age){
        if (age>=18&&age<=50){
            this.age = age;
        }else {
            System.out.println("数据不合法");
        }

    }
    public int getAge(){
        return age;
    }
    public void setName(String name){
        this.name = name;
    }
    public String getName(){
        return name;
    }
    public void sleep(){
        System.out.println("女朋友喜欢睡觉");
    }
}
